package com.scalar.chiptrack.finance.proformainvoice.forms;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import java.util.ArrayList;

import com.scalar.chiptrack.sales.SalesOrder;
import com.scalar.chiptrack.commons.Address;
import com.scalar.chiptrack.finance.proformainvoice.ProformaInvoiceLineItem;

import javax.servlet.http.HttpServletRequest;

/**
 * User: KP
 * Date: Sep 28, 2006
 * Time: 3:08:44 PM
 */
public class ProformaInvoiceForm extends ActionForm
{

    /* Start following properties are only used in search screens*/
    private int searchSalesOrderId      = -1;
    private int searchCustomerId        = -1;
    private int searchProcessstepId     = -1;
    private String searchSalesOrderNo   = "";
    private String searchInvoiceNo      = "";
    private String searchPONumber       = "-1";
    private String searchYear           = "";
    /* End */
    private int invoiceId               = -1;
    private int salesOrderId            = -1;
    private int customerId              = 0;
    private int bankId                  = 0;

    private String invoiceNo            = null;
    private String invoiceDate          = null;

    private Address bankAddress         = null;
    private String bankName             = null;
    private String bankAddress1         =null;
    private String bankCity             = null;
    private String bankState            = null;
    private String bankZipCode          = null;
    private String bankCountry          = null;
    private String aba                  = null;
	private String acct                 = null;
	private String swiftcode            = null;
	private String bankNames            = null;

    private String status               = null;
    private ArrayList lineItemList      = null;
    private SalesOrder salesOrder       = null;
    private String manufacturingPartNo  = null;

    public int getSearchSalesOrderId() {
        return searchSalesOrderId;
    }

    public void setSearchSalesOrderId(int searchSalesOrderId) {
        this.searchSalesOrderId = searchSalesOrderId;
    }


    public int getSearchCustomerId() {
        return searchCustomerId;
    }

    public void setSearchCustomerId(int searchCustomerId) {
        this.searchCustomerId = searchCustomerId;
    }

    public int getSearchProcessstepId() {
        return searchProcessstepId;
    }

    public void setSearchProcessstepId(int searchProcessstepId) {
        this.searchProcessstepId = searchProcessstepId;
    }

    public String getSearchSalesOrderNo() {
        return searchSalesOrderNo;
    }


    public String getSearchInvoiceNo() {
        return searchInvoiceNo;
    }

    public void setSearchInvoiceNo(String searchInvoiceNo) {
        this.searchInvoiceNo = searchInvoiceNo;
    }

    public void setSearchSalesOrderNo(String searchSalesOrderNo) {
        this.searchSalesOrderNo = searchSalesOrderNo;
    }

    public String getSearchPONumber() {
        return searchPONumber;
    }


    public String getSearchYear() {
        return searchYear;
    }

    public void setSearchYear(String searchYear) {
        this.searchYear = searchYear;
    }


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public ArrayList getLineItemList() {
        return lineItemList;
    }

    public void setLineItemList(ArrayList lineItemList) {
        this.lineItemList = lineItemList;
    }

    public void setSearchPONumber(String searchPONumber) {
        this.searchPONumber = searchPONumber;
    }


    public int getInvoiceId() {
        return invoiceId;
    }

    public void setInvoiceId(int invoiceId) {
        this.invoiceId = invoiceId;
    }


    public int getSalesOrderId() {
        return salesOrderId;
    }

    public void setSalesOrderId(int salesOrderId) {
        this.salesOrderId = salesOrderId;
    }


    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }


    public String getInvoiceDate() {
        return invoiceDate;
    }

    public void setInvoiceDate(String invoiceDate) {
        this.invoiceDate = invoiceDate;
    }

    public SalesOrder getSalesOrder() {
        return salesOrder;
    }

    public void setSalesOrder(SalesOrder salesOrder) {
        this.salesOrder = salesOrder;
    }


    public Address getBankAddress() {
        return bankAddress;
    }

    public void setBankAddress(Address bankAddress) {
        this.bankAddress = bankAddress;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getAba() {
        return aba;
    }

    public void setAba(String aba) {
        this.aba = aba;
    }

    public String getAcct() {
        return acct;
    }

    public void setAcct(String acct) {
        this.acct = acct;
    }

    public String getSwiftcode() {
        return swiftcode;
    }

    public void setSwiftcode(String swiftcode) {
        this.swiftcode = swiftcode;
    }


    public String getManufacturingPartNo() {
        return manufacturingPartNo;
    }

    public void setManufacturingPartNo(String manufacturingPartNo) {
        this.manufacturingPartNo = manufacturingPartNo;
    }

    public int getCustomerId() {
        return customerId;
    }

    public void setCustomerId(int customerId) {
        this.customerId = customerId;
    }


    public int getBankId() {
        return bankId;
    }

    public void setBankId(int bankId) {
        this.bankId = bankId;
    }


    public String getBankAddress1() {
        return bankAddress1;
    }

    public void setBankAddress1(String bankAddress1) {
        this.bankAddress1 = bankAddress1;
    }


    public String getBankCity() {
        return bankCity;
    }

    public void setBankCity(String bankCity) {
        this.bankCity = bankCity;
    }

    public String getBankState() {
        return bankState;
    }

    public void setBankState(String bankState) {
        this.bankState = bankState;
    }

    public String getBankZipCode() {
        return bankZipCode;
    }

    public void setBankZipCode(String bankZipCode) {
        this.bankZipCode = bankZipCode;
    }

    public String getBankCountry() {
        return bankCountry;
    }

    public void setBankCountry(String bankCountry) {
        this.bankCountry = bankCountry;
    }

    public String getBankNames() {
        return bankNames;
    }

    public void setBankNames(String bankNames) {
        this.bankNames = bankNames;
    }

    public String getBankDetailsAsString()
    {
        StringBuffer info = new StringBuffer( "" );

        if( aba != null && aba.trim().length() > 0 )
        {
            info.append( "<BR>ABA :" + aba + "\n" );
        }
        if( acct != null && acct.trim().length() > 0 )
        {
            info.append( "<BR>Acct :" + acct + "\n" );
        }
        if( swiftcode != null && swiftcode.trim().length() > 0 )
        {
            info.append( "<BR>Swift Code :" + swiftcode + "\n" );
        }

        return info.toString();
    }


    public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest)
    {
        if( lineItemList != null )
        {
            ProformaInvoiceLineItem lineItem = null;
            for (int i = 0; i < lineItemList.size(); i++)
            {
                lineItem = ( ProformaInvoiceLineItem ) lineItemList.get( i );
                lineItem.setSelected( false );
            }
        }
    }

}
